#region Copyright

// // ======================================================
// //     Copyright (c) 2011 Toulr All rights reserved.
// //    
// //     The use and distribution terms for this software are contained in the file
// //     named license.txt, which can be found in the root of this distribution.
// //     By using this software in any fashion, you are agreeing to be bound by the
// //     terms of this license.
// //    
// //     You must not remove this notice, or any other, from this software.
// // ======================================================

#endregion

#region Using Namespaces

using System;
using System.Collections;
using System.Collections.Specialized;
using System.Text;

#endregion

namespace Toulr.Util.Net.Email
{
    #region

    

    #endregion

    /// <summary>
    ///   Message formats
    /// </summary>
    public enum Format
    {
        /// <summary>
        ///   The body is composed of html content
        /// </summary>
        Html,
        /// <summary>
        ///   The body is pure text
        /// </summary>
        Text
    }

    /// <summary>
    ///   Message priority
    /// </summary>
    public enum MessagePriority
    {
        /// <summary>
        /// </summary>
        Normal,
        /// <summary>
        /// </summary>
        High,
        /// <summary>
        /// </summary>
        Low
    }

    /// <summary>
    ///   Abstracts an e-mail message
    /// </summary>
    public class Message
    {
        private readonly MessageAttachmentCollection _attachments = new MessageAttachmentCollection();
        private readonly IDictionary _fields = new HybridDictionary();
        private readonly IDictionary _headers = new HybridDictionary();
        private Encoding _encoding = Encoding.UTF8;
        private Format _format = Format.Text;
        private MessagePriority _priority = MessagePriority.Normal;

        /// <summary>
        ///   Initializes a new instance of the <see cref = "Message" /> class.
        /// </summary>
        public Message()
        {
        }

        /// <summary>
        ///   Initializes a new instance of the <see cref = "Message" /> class.
        /// </summary>
        /// <param name = "from">From header.</param>
        /// <param name = "to">To header.</param>
        /// <param name = "subject">The subject header.</param>
        /// <param name = "body">The message body.</param>
        public Message(string from, string to, string subject, string body)
        {
            To = to;
            From = from;
            Body = body;
            Subject = subject;
        }

        /// <summary>
        ///   Gets or sets to.
        /// </summary>
        /// <value>To.</value>
        /// Author     :James Cheung
        /// MachineName:HJZHANG@METARNE-HJZHANG
        /// DateTime   :2009-1-21 16:46
        public String To { get; set; }

        /// <summary>
        ///   Gets or sets from.
        /// </summary>
        /// <value>From.</value>
        /// Author     :James Cheung
        /// MachineName:HJZHANG@METARNE-HJZHANG
        /// DateTime   :2009-1-21 16:46
        public String From { get; set; }

        /// <summary>
        ///   Gets or sets the cc.
        /// </summary>
        /// <value>The cc.</value>
        /// Author     :James Cheung
        /// MachineName:HJZHANG@METARNE-HJZHANG
        /// DateTime   :2009-1-21 16:46
        public String Cc { get; set; }

        /// <summary>
        ///   Gets or sets the BCC.
        /// </summary>
        /// <value>The BCC.</value>
        /// Author     :James Cheung
        /// MachineName:HJZHANG@METARNE-HJZHANG
        /// DateTime   :2009-1-21 16:46
        public String Bcc { get; set; }

        /// <summary>
        ///   Gets or sets the body.
        /// </summary>
        /// <value>The body.</value>
        /// Author     :James Cheung
        /// MachineName:HJZHANG@METARNE-HJZHANG
        /// DateTime   :2009-1-21 16:46
        public String Body { get; set; }

        /// <summary>
        ///   Gets or sets the subject.
        /// </summary>
        /// <value>The subject.</value>
        /// Author     :James Cheung
        /// MachineName:HJZHANG@METARNE-HJZHANG
        /// DateTime   :2009-1-21 16:46
        public String Subject { get; set; }

        /// <summary>
        ///   Gets or sets the format.
        /// </summary>
        /// <value>The format.</value>
        /// Author     :James Cheung
        /// MachineName:HJZHANG@METARNE-HJZHANG
        /// DateTime   :2009-1-21 16:46
        public Format Format
        {
            get { return _format; }
            set { _format = value; }
        }

        /// <summary>
        ///   Gets or sets the encoding.
        /// </summary>
        /// <value>The encoding.</value>
        /// Author     :James Cheung
        /// MachineName:HJZHANG@METARNE-HJZHANG
        /// DateTime   :2009-1-21 16:46
        public Encoding Encoding
        {
            get { return _encoding; }
            set { _encoding = value; }
        }

        /// <summary>
        ///   Gets or sets the priority.
        /// </summary>
        /// <value>The priority.</value>
        /// Author     :James Cheung
        /// MachineName:HJZHANG@METARNE-HJZHANG
        /// DateTime   :2009-1-21 16:46
        public MessagePriority Priority
        {
            get { return _priority; }
            set { _priority = value; }
        }

        /// <summary>
        ///   Gets the headers.
        /// </summary>
        /// <value>The headers.</value>
        /// Author     :James Cheung
        /// MachineName:HJZHANG@METARNE-HJZHANG
        /// DateTime   :2009-1-21 16:46
        public IDictionary Headers
        {
            get { return _headers; }
        }

        /// <summary>
        ///   Gets the fields.
        /// </summary>
        /// <value>The fields.</value>
        /// Author     :James Cheung
        /// MachineName:HJZHANG@METARNE-HJZHANG
        /// DateTime   :2009-1-21 16:46
        public IDictionary Fields
        {
            get { return _fields; }
        }

        /// <summary>
        ///   Gets the attachments.
        /// </summary>
        /// <value>The attachments.</value>
        /// Author     :James Cheung
        /// MachineName:HJZHANG@METARNE-HJZHANG
        /// DateTime   :2009-1-21 16:46
        public MessageAttachmentCollection Attachments
        {
            get { return _attachments; }
        }
    }
}